package com.hongruan.utils;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.hongruan.bean.Menu;
import com.hongruan.service.MenuService;

/**
 * 加载数据库值类
 * @author ZhangWenLong
 *
 */
@Component
public class DBDataLoader {

	private static Logger logger = Logger.getLogger(DBDataLoader.class);
	
	@Resource
	private MenuService menuService;
	
	private static List<Menu> menuList = new ArrayList<Menu>();
	
	@PostConstruct
	public void init(){
		logger.info("Load menu list from Database begin...");
		
		menuList = this.menuService.getMenuList(0);
		
		logger.info("Load menu list from Database end...");
	}
	
	public static List<Menu> getMenuList() {
		return menuList;
	}
}
